package com.platform.enums;

import com.platform.comm.enums.IDictEntry;
import com.platform.comm.enums.IEnumItem;

/**
 * Title: DirExWayType
 * Description: 资源交换途径类型枚举
 * Date 2020/4/20
 *
 * @author wxw
 * @version v1.0
 */
public enum DirExWayType implements IDictEntry, IEnumItem {

    /**
     * 文件_批量_中心库
     */
    FILE_PL_ZX(DirExTransmitKind.FILE, DirExProcessType.PL, DirExSourceType.ZXDB),

    /**
     * 文件_批量_贴源库
     */
    FILE_PL_CS(DirExTransmitKind.FILE, DirExProcessType.PL, DirExSourceType.CSDB),

    /**
     * 手工_单条_贴源库
     */
    SG_DT_CS(DirExTransmitKind.SG, DirExProcessType.DT, DirExSourceType.CSDB),

    /**
     * 库对库_批量_贴源库
     */
    DB_PL_CS(DirExTransmitKind.DB_DB,DirExProcessType.PL,DirExSourceType.CSDB);


    private final DirExTransmitKind kind;
    private final DirExProcessType processType;
    private final DirExSourceType sourceType;

    DirExWayType(DirExTransmitKind kind, DirExProcessType processType, DirExSourceType sourceType) {
        this.kind = kind;
        this.processType = processType;
        this.sourceType = sourceType;
    }

    @Override
    public String getKey() {
        return name();
    }

    @Override
    public String getValue() {
        return this.kind.getKey() + "_" + this.processType.getKey() + "_" + this.sourceType.getKey();
    }

    public static DirExWayType getExWayType(String value) {
        for (DirExWayType dirExWayType : values()) {
            if (dirExWayType.is(value)) {
                return dirExWayType;
            }
        }
        return null;
    }

    public DirExTransmitKind getKind() {
        return this.kind;
    }

    public DirExProcessType getType() {
        return this.processType;
    }

    public DirExSourceType getSourceType() {
        return this.sourceType;
    }

    @Override
    public Object getData() {
        return this;
    }

    @Override
    public boolean is(String value) {
        return name().equals(value);
    }

}
